(* test.ml
 *
 * This file is part of camEngine
 * 
 * camEngine - A 3d motor for ocaml
 * Copyright (C) 2009 DAVY Guillaume <davyg2@gmail.com>
 *
 * camEngine is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * camEngine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with camEngine.  If not, see <http://www.gnu.org/licenses/>.
 *)

open CamEngine;;
open CamEngine.Core;;
open CamEngine.Vec3d;;
open CamEngine.Driver;;

print_int black;;
print_string "\n";;
print_int blue;;
print_string "\n";;
print_int red;;
print_string "\n";;
print_int green;;
print_string "\n";;
print_int yellow;;
print_string "\n";;
print_int white;;
print_string "\n";;

let c = new core;;
let d = c#getDriver;;
let s = c#getScene;;
d#set_title "test";;

print_string "Init\n";;
c#init;;

print_string "addMeshNode1\n";;

let n1 = s#addMeshNode (d#getMesh "daline_pyramidale.obj");;


(*print_string "addMeshNode2\n";;
let n2 = s#addMeshNode (d#getMesh "cessna.obj");;
n2#set_pos (new vec3d 0. (0. -. 2.) 4.);;*)

let i = ref 1. ;;

let center = new vec3d 200. 200. 0.;;
let moving = new vec3d 300. 400. 0.;;
let rec radar = function
t when t>2. *. 3.142 -> radar 0.
|t ->(
moving#set_x (200. +. 100. *. (cos t));
moving#set_y (200. +. 100. *. (sin t));(*
print_float center#get_x;
print_string " ";
print_float center#get_y;
print_string " ";
print_float moving#get_x;
print_string " ";
print_float moving#get_y;
print_string "\n";*)
	d#preRender;
d#line center moving blue;
	d#postRender;
	let rec waste = function
		| 0 -> ()
		| x -> waste (x-1)
		in
		waste 99999999;
radar (t +. 0.1);
);;

radar 0.;

print_string "while\n";;
while true do
	n1#set_pos (new vec3d 1. (0. -. 2.) !i);
	(*i := !i +. 0.1;
	d#preRender;
	s#drawAll;
	d#postRender;*)
done

